home *** CD-ROM | disk | FTP | other *** search
/ Family Forum 253 / SOMC Family Forum 253 - Disc 1.iso / BMPE.RUL < prev    next >
Text File  |  1997-08-20  |  11KB  |  413 lines

  1. declare
  2.  
  3. // Constant declarations.
  4.  
  5. #define SPACE_REQUIRED           5000000          // Disk space in bytes.
  6. #define APP_NAME                "Best Math Program"
  7. #define PROGRAM_FOLDER_NAME     "Richard Scarry"
  8. #define APPBASE_PATH            "RSBMPE\\"
  9. #define APPBASE_PATH_WIN32S     "Program Files\\Richard Scarry\\Best Math Program"
  10. #define COMPANY_NAME            "Richard Scarry"
  11. #define PRODUCT_NAME            "Best Math Program"
  12. #define PRODUCT_VERSION         "1.0"
  13. #define UNINSTALL_NAME          "Richard Scarry's Best Math Program"
  14. #define PRODUCT_KEY             "Best Math Program"
  15. #define INITFILE_NAME        "Busytown.ini"
  16. #define HTMDIR            "BMPEHTM"
  17. #define HTMFILE            "web.htm"
  18.  
  19.     // Global variable declarations.
  20.  
  21.         STRING  svFolder, svDir, szMsg, szFileSet, szTitle, szCD, svUninstLogFile, szVersion;
  22.         STRING  svTarget, svProgram, szParam, szShortPath, szTemp, svAppPath;
  23.     STRING  szResult, szShare, szShareEx;
  24.     STRING  szBitmap1[1024], szBitmap2[1024];
  25.     STRING  szSampler, szSampPath, szReadme;
  26.     STRING    szProgram,szSource,szIconFile,szGrade,szTextFile;
  27.     STRING     szVolumeName,szWorkDir,szFileName,szUnInstall,szQTime;
  28.     BOOL    bSpaceOk, bWinNT, bWin32s, bWin16s, bWin95;
  29.     NUMBER  nResult, nTemp, nColors, nlist,nGrade;
  30.  
  31.         // Function declarations.
  32.         prototype SetupScreen();
  33.         prototype CheckRequirements();
  34.  
  35. program
  36.  
  37. StartHere:
  38.             
  39.     ParsePath(szCD, SRCDIR, DISK);   
  40.  
  41.     szVolumeName = szCD;
  42.  
  43.     //GetSystemInfo(VOLUMELABEL,nTemp,szVolumeName );   
  44.     
  45.     //if (szVolumeName = "Foggy") then
  46.  
  47.     //    szGrade="2";
  48.  
  49.     //    nGrade=2;
  50.  
  51.     
  52.     //else  
  53.         //szGrade="1";
  54.  
  55.         //nGrade=1;
  56.  
  57.     //endif;
  58.  
  59.  
  60.     //StrToNum(nGrade,szGrade);
  61.  
  62.     GetProfString(WINDIR^INITFILE_NAME, APP_NAME ,"WorkingDir",szWorkDir);
  63.  
  64.     if (szWorkDir != "") then
  65.         
  66.         GetProfString(WINDIR^INITFILE_NAME, APP_NAME ,"AppName",szFileName);
  67.  
  68.         FindFile(szWorkDir,szFileName,szFileName) ;
  69.  
  70.         if szFileName != "" then 
  71.             
  72.             Disable( BACKGROUND );
  73.  
  74.             szMsg = "Would you like to play " + APP_NAME + " now ?" ;
  75.         
  76.             if (AskYesNo(szMsg,YES) = YES) then
  77.             
  78.             //MessageBox( szFileName, INFORMATION );
  79.  
  80.             LaunchApp(szWorkDir^szFileName, "");    
  81.             
  82.             endif;
  83.  
  84.             exit;
  85.         endif;
  86.     
  87.     endif;
  88.  
  89.         InstallationInfo( COMPANY_NAME, PRODUCT_NAME , PRODUCT_VERSION, PRODUCT_KEY );    
  90.  
  91.         SetupScreen();
  92.  
  93.         Enable( DIALOGCACHE );
  94.  
  95.    WelcomeDlg:
  96.  
  97.         Disable( BACKBUTTON );
  98.  
  99.         Welcome( "Welcome to " + APP_NAME, 0 );
  100.  
  101.         Enable( BACKBUTTON );
  102.  
  103.         CheckRequirements();
  104.  
  105. InstallExe:
  106.  
  107. // Ask user for a destination location for the installation.
  108.     
  109. GetTargetDirectory:
  110.  
  111.         if (bWin95) then
  112.  
  113.            svTarget     =     TARGETDISK ^ APPBASE_PATH_WIN32S;
  114.        szProgram    =    "RSMath95.exe";    
  115.        szUnInstall    =    "UnInst.exe";    
  116.        szQTime     =     "Qt32inst.exe";
  117.     
  118.         else
  119.  
  120.            svTarget     =     TARGETDISK ^ APPBASE_PATH;
  121.        szProgram    =    "RSMath31.exe";
  122.        szUnInstall    =    "UnInst16.exe";
  123.        szQTime     =     "Qt16inst.exe";
  124.         endif;
  125.  
  126.     szTextFile    =    "Readme.txt";
  127.         if ( AskDestPath( "", szMsg,
  128.                           svTarget, 0 ) = 12 ) then
  129.            goto WelcomeDlg;
  130.  
  131.         endif;
  132.  
  133.         // Perform space check of target drive.
  134.  
  135.         bSpaceOk = TRUE;
  136.  
  137.         if (GetDiskSpace( svTarget ) < SPACE_REQUIRED) then
  138.  
  139.            szMsg = "There is not enough space available on the disk\n" +
  140.                    "'" + svTarget + "' \n" +
  141.                    "Please free up some space or change the target location\n" +
  142.                    "to a different disk";
  143.  
  144.            MessageBox( szMsg, WARNING );
  145.            bSpaceOk = FALSE;
  146.  
  147.         endif;
  148.  
  149.          // If not enough space, ask user to try again.
  150.  
  151.         if (bSpaceOk = FALSE) goto GetTargetDirectory;
  152.  
  153.     // Set the App Paths key for the main program.
  154.     //if (bWin95) then
  155.  
  156.         svAppPath = svTarget;
  157.  
  158.            svProgram = svTarget ^ szProgram;
  159.     
  160.     //MessageBox( svAppPath, WARNING );
  161.  
  162.         //Set the App Paths key for the main program.
  163.  
  164.            RegDBSetItem(REGDB_APPPATH, svAppPath );
  165.            RegDBSetItem(REGDB_APPPATH_DEFAULT, svProgram );
  166.     RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
  167.     
  168.     DeinstallStart(svAppPath, svUninstLogFile, APP_NAME, 0);
  169.     
  170.     RegDBSetItem(REGDB_UNINSTALL_NAME, UNINSTALL_NAME);
  171.  
  172.         szFileSet =     "General";
  173.  
  174.         szTemp       =     SRCDIR;
  175.         
  176.         TARGETDIR =     svTarget;
  177.             
  178.         Enable( STATUS );
  179.         
  180.     //Enable( INDVFILESTATUS );
  181.  
  182.     Disable( INDVFILESTATUS );
  183.  
  184.     SetStatusWindow( -1, "Copying program files..." );
  185.  
  186.     StatusUpdate(ON,10);
  187.  
  188.     CopyFile(szTextFile, szTextFile);
  189.  
  190.     //StatusUpdate(ON,40);
  191.  
  192.     //XCopyFile(HTMDIR^"\\*.*","*.*",INCLUDE_SUBDIR);
  193.  
  194.     if (FindFile(WINDIR, szUnInstall, szUnInstall ) < 0) then
  195.         TARGETDIR = WINDIR;
  196.         StatusUpdate(ON,50);
  197.         CopyFile( szUnInstall , szUnInstall);
  198.         TARGETDIR = svTarget;
  199.     endif;
  200.  
  201.     StatusUpdate(ON,100);
  202.     CopyFile(szProgram, szProgram);
  203.     
  204.     Delay (1);
  205.  
  206.     Disable( DIALOGCACHE );
  207.         Disable( FEEDBACK_FULL );
  208.     Disable( STATUS);
  209.     Disable( STATUSDLG);       
  210.  
  211.     InstallProgramItems:   
  212.              
  213.     //Add program icons
  214.  
  215.     svFolder=PROGRAM_FOLDER_NAME;
  216.  
  217.     SelectFolder("Folder Selection" , PROGRAM_FOLDER_NAME , svFolder );
  218.  
  219.     ShowProgramFolder(svFolder, SW_NORMAL);
  220.         
  221.     svProgram = svTarget ^ szTextFile; 
  222.  
  223.     LongPathToQuote(svProgram, TRUE);
  224.  
  225.         AddFolderIcon( svFolder,APP_NAME + " Read Me", svProgram, svTarget, "", 0, "", REPLACE );
  226.     
  227.     LongPathToShortPath(svUninstLogFile);
  228.  
  229.     szTemp = WINDIR ^ szUnInstall + " -f" + svUninstLogFile ; 
  230.  
  231.     //LongPathToQuote(szTemp, TRUE);
  232.  
  233.         AddFolderIcon( svFolder,"UnInstall " + APP_NAME , szTemp, WINDIR , "", 0, "", REPLACE );
  234.  
  235.     //svProgram = SRCDIR ^ HTMDIR^HTMFILE; 
  236.  
  237.     //LongPathToQuote(svProgram, TRUE);
  238.  
  239.         //AddFolderIcon( svFolder,APP_NAME + " Online", svProgram, SRCDIR^HTMDIR,SRCDIR^HTMDIR^"MM.ico", 0, "", REPLACE );
  240.     
  241.     //LongPathToShortPath(szShortPath);   
  242.  
  243.      svProgram = svTarget ^ szProgram; 
  244.  
  245.     szShortPath=svProgram;
  246.  
  247.     LongPathToShortPath(szShortPath);
  248.     
  249.     //LongPathToQuote(svProgram, TRUE);
  250.  
  251.         AddFolderIcon( svFolder, APP_NAME, szShortPath, svTarget,SRCDIR^"Busytown.ico" , 0 , "", REPLACE );
  252.  
  253.     //WriteProfString(WINDIR^INITFILE_NAME, APP_NAME, "exeName", szShortPath);
  254.  
  255.     WriteProfString(WINDIR^INITFILE_NAME, APP_NAME, "version", "1.0");
  256.  
  257.     WriteProfString(WINDIR^INITFILE_NAME, APP_NAME, "AutoRun", "ON");
  258.  
  259.     WriteProfString(WINDIR^INITFILE_NAME, APP_NAME, "WorkingDir" , svTarget);
  260.  
  261.     WriteProfString(WINDIR^INITFILE_NAME, APP_NAME, "AppName" , szProgram);
  262.         
  263.  
  264.            szMsg = "Program installed successfully!\n\n\n\nYou may run " + APP_NAME +
  265.         " by double-clicking" +
  266.         " on the program icon located in "+ svFolder +" Program Group.\n\n" +
  267.                "Please check the README file for any last minute information concerning the program.";
  268.  
  269.         MessageBox(szMsg, INFORMATION);
  270.  
  271.     //Last - Check user's current setup for VGA and tell them to change to higher.
  272.         
  273.             if (nColors =  16) then
  274.             szMsg = APP_NAME + " requires your video driver to be set " +
  275.                     "to at least 256 colors. Consult the readme file for " +
  276.                     "information on changing your current display setting.";
  277.             MessageBox(szMsg, WARNING);
  278.             endif;
  279.  
  280.             if (nColors >  256) then
  281.             szMsg = APP_NAME+ " runs best when your video driver is set " +
  282.                     "to 256 colors. Consult the readme file for " +
  283.                     "information on changing your current display setting.";
  284.             MessageBox(szMsg, WARNING);
  285.             endif;
  286.     
  287.         LaunchAppAndWait(szQTime,"" , WAIT );
  288.  
  289.     szMsg = "Would you like to run " + APP_NAME + " ?" ;
  290.  
  291.     szTemp =svProgram;
  292.  
  293.     Disable( BITMAP256COLORS );
  294.  
  295.     Disable( BACKGROUND );
  296.  
  297.     //LongPathToQuote(szTemp , TRUE);
  298.     
  299.         if (AskYesNo(szMsg,YES) = YES) then
  300.               LaunchApp(szTemp, "");    
  301.  
  302.     endif;    
  303.  
  304.         exit;
  305.  
  306.  
  307. /*---------------------------------------------------------------------------*\
  308.  *
  309.  * Function:  SetupScreen
  310.  *
  311.  *  Purpose:  This function will set up the screen look.  This includes
  312.  *            colors, fonts, text to be displayed, etc.
  313.  *
  314.  *
  315.  *    Input:
  316.  *
  317.  *  Returns:
  318.  *
  319.  * Comments:
  320. \*---------------------------------------------------------------------------*/
  321. function SetupScreen()
  322.         number nDx, nDy;
  323. begin
  324.  
  325.         GetExtents( nDx, nDy );
  326.         Enable( FULLWINDOWMODE );
  327.     
  328.         Enable( INDVFILESTATUS );
  329.         Enable( BITMAP256COLORS );
  330.         Enable( DIALOGCACHE );
  331.  
  332.         SetColor( BACKGROUND, BK_BLUE ); // Dark blue.
  333.         SetColor( STATUSBAR, BLUE );            // Bright blue.
  334.  
  335.         SetTitle( APP_NAME+" Setup", 0, BACKGROUNDCAPTION ); // Caption bar text.
  336.       Enable( BACKGROUND );
  337.     //PlaceBitmap("Setup.bmp",1,nDx/2 - 320,nDy/2 - 240 , UPPER_RIGHT);
  338.         Delay( 1 );
  339.     
  340.  
  341. end;
  342.  
  343. /*---------------------------------------------------------------------------*\
  344.  *
  345.  * Function:  CheckRequirements
  346.  *
  347.  *  Purpose:  This function will check all minimum requirements for the
  348.  *            application being installed.  If any fail, then the user
  349.  *            is informed and the installation is terminated.
  350.  *
  351.  *
  352.  *    Input:
  353.  *
  354.  *  Returns:
  355.  *
  356.  * Comments:
  357. \*---------------------------------------------------------------------------*/
  358. function CheckRequirements()
  359. number nvDx, nvDy;
  360. number nvResult;
  361. STRING svResult;
  362.  
  363. begin
  364.  
  365.         // Check screen resolution.
  366.         GetExtents( nvDx, nvDy );
  367.         if (nvDy < 480) then
  368.            MessageBox( "This program requires VGA or better resolution.", WARNING );
  369.            exit;
  370.         endif;
  371.  
  372.         // Determine the target system's operating system.
  373.         GetSystemInfo( OS, nvResult, svResult );
  374.         bWinNT  = FALSE;
  375.         bWin32s = FALSE;
  376.         bWin16s = FALSE;
  377.         if (nvResult =  IS_WINDOWSNT) then
  378.            bWinNT = TRUE; // Running Windows NT.
  379.         elseif (nvResult =  IS_WIN32S) then 
  380.            bWin32s = TRUE; // Running Win32s.
  381.         elseif (nvResult =  IS_WINDOWS95) then 
  382.            bWin95 = TRUE; // Running Win95.
  383.         elseif (nvResult =  IS_WINDOWS) then 
  384.            bWin16s = TRUE; // Running Windows.
  385.         endif;
  386.  
  387. end;
  388.  
  389. /*---------------------------------------------------------------------------*\
  390.  *
  391.  * Function:  
  392.  *
  393.  *  Purpose:  
  394.  *
  395.  *    Input:
  396.  *
  397.  *  Returns:
  398.  *
  399.  * Comments:
  400. \*---------------------------------------------------------------------------*/
  401. //function PlaySound()
  402.  
  403. //begin
  404.  
  405. //            PlaceBitmap( szBitmap1, 1, CENTERED, CENTERED, CENTERED | BITMAPICON );
  406. //            LaunchApp( "PLAYSND.EXE", "" );
  407. //            LaunchAppAndWait("PLAYSND.EXE", "",NOWAIT);
  408. //            Delay (7);
  409.  
  410.  
  411. //end;
  412.  
  413.